"""
验证token是否过期
"""
import requests
from src.config import settings


def check_token(token):
    """校验token"""
    try:
        response = requests.get(settings.user_account_url,
                                headers={'token': token}, timeout=5)
    except Exception as e:
        return 1002
    if response.status_code == 401:
        return 1001
    else:
        return 1000
